<form id="${id}" name="${id}" method="post" class="eova-form" >
<%
		// 获取分组元字段数据
		var fields = query("form_field", code);

		for(f in fields){
			var flag = (f.type == '单选框' || f.type == '文本域' || f.type == '编辑框' || f.type == '多图框' || f.type == '附件框');
%>
			<div class="eova-form-field" style="${flag ? 'display: block;' : ''}">
				<label class="eova-form-label${isTrue(f.is_required!) ? ' red' : ''}">${f.cn}</label>
<%
				if(f.type == '下拉框'){
%>
					<#combo id="${f.en}" name="${f.en}" exp="${f.exp}" value="${f.defaulter!}" placeholder="${f.placeholder!}" multiple="${f.is_multiple}" />
<%
				} else if(f.type == '查找框'){
%>
					<#find id="${f.en}" name="${f.en}" exp="${f.exp}" value="${f.defaulter!}" placeholder="${f.placeholder!}" multiple="${f.is_multiple}" />
<%
				} else if(f.type == "多图框"){
%>
					<#imgs id="${f.en}" name="${f.en}" code="EOVA_FLOW_WIDGET,${f.widget_id}" value="${f.defaulter!}" filedir="${f.config.filedir!}" imgWidth="${f.config.width!}" imgHeight="${f.config.height! }" />
<%
				} else if(f.type == "附件框"){
%>
					<#files id="${f.en}" name="${f.en}" code="EOVA_FLOW_WIDGET,${f.widget_id}" value="${f.defaulter!}" filedir="${f.config.filedir!}"/>
<%
				} else {
%>
					<#field item="${f}" value="${f.defaulter!}" />
<%
				}				
%>
			</div>
<%      
			if(!isEmpty(f.items) && f.type == '下拉框'){
%>
				<script>
				$(function(){
					var $type = $('#${f.en}').eovacombo({
						json : ${f.items_json}
					}).reload();
				})
				</script>
<%
			}
		}
%>
</form>
<script>
$(function(){
    var $form = $('#${id}');
    $form.validator({
        debug: false,
        stopOnError: true,
        focusInvalid : true,
        showOk: false,
        timely: 0,
        msgMaker: false,
        fields: {
	        <%for(f in fields){%>
	        	<%if((isTrue(f.is_required) || !isEmpty(f.validator))){%>
	                ${f.en} : { rule: "${isTrue(f.is_required)?f.cn + ':required;' : ''}${f.validator!}" },
	            <%}%>
	        <%}%>
        }
    });
    $form.on("validation", $.validation);
});
</script>